<form role="form" id="form" action="{:U("Menu/add_menu")}">
<label for="name"><font color="red">注:一级菜单最多有三个,二级菜单最多有五个</font></label>
    <!-- 一级菜单 -->
   <div class="form-group">
      <label for="name">一级菜单名称</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入一级名称,必填" name="name" />
   </div>
    <div class="form-group">
      <label for="name">事件类型</label>
      <select name="type" id="tesetSelect" form="form"  onchange="tt(this.id)">
      	<option value="click">点击推事件</option>
        <option value="view">跳转URL</option>
      	<option value="scancode_push">扫码推事件</option>
        <option value="scancode_waitmsg">扫码事件且弹出“消息接收中”提示框</option>
        <option value="pic_sysphoto">弹出系统拍照发图</option>
        <option value="pic_photo_or_album">弹出拍照或者相册发图</option>
        <option value="pic_weixin">弹出微信相册发图器</option>
        <option value="location_select">弹出地理位置选择器</option>
        <option value="media_id">下发消息(除文本消息)</option>
        <option value="view_limited">跳转图文的URL</option>
      </select>
   </div>
    <div class="form-group" id="key">
      <label for="name">key</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入key的值" name="key" />
   </div>
    <div class="form-group" id="url">
      <label for="name">url</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入要跳转的URL" name="url" />
   </div>
   <div class="form-group" id="media_id">
      <label for="name">media_id</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入meidia_id的值" name="media_id" />
   </div>
 

<!-- 二级菜单 -->
<div class="form-group" id="twoname">
      <label for="name">二级菜单名称</label>
      <input type="text" class="form-control"  
         placeholder="请输入二级名称，必填" name="two_name" />
   </div>
    <div class="form-group" id="event">
      <label for="name">事件类型</label>
      <select name="two_type" id="select" form="form"  onchange="ttt(this.id)">
        <option value="click">点击推事件</option>
        <option value="view">跳转URL</option>
        <option value="scancode_push">扫码推事件</option>
        <option value="scancode_waitmsg">扫码事件且弹出“消息接收中”提示框</option>
        <option value="pic_sysphoto">弹出系统拍照发图</option>
        <option value="pic_photo_or_album">弹出拍照或者相册发图</option>
        <option value="pic_weixin">弹出微信相册发图器</option>
        <option value="location_select">弹出地理位置选择器</option>
        <option value="media_id">下发消息(除文本消息)</option>
        <option value="view_limited">跳转图文的URL</option>
      </select>
   </div>
    <div class="form-group" id="key1">
      <label for="name">key</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入key的值" name="key1" />
   </div>
    <div class="form-group" id="url1">
      <label for="name">url</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入要跳转的URL" name="url1" />
   </div>
   <div class="form-group" id="media_id1">
      <label for="name">media_id</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入meidia_id的值" name="media_id1" />
   </div>
    <button type="submit" class="btn btn-default">提交</button>
</form>
<!-- 一级菜单 -->
<script type="text/javascript">
//根据菜单类型，弹出适当的选项
var a=$('#tesetSelect').val();//选中的值
//alert(a);
if (a=='click' || a=='scancode_push' || a=='scancode_waitmsg'  || a=='pic_sysphoto'  || a=='pic_photo_or_album'  || a=='pic_weixin'  || a=='location_select') {
      $("#key").show();
      $("#url").hide();
      $("#media_id").hide();
  }else{
      $("#key").hide();
  };
  if (a=='view') {
      $("#url").show();
  }else{
      $("#url").hide();
  };
function tt(id) {
  var aa = document.getElementById(id).value;
  var a=aa;
 //alert(a);
  if (a=='click' || a=='scancode_push' || a=='scancode_waitmsg'  || a=='pic_sysphoto'  || a=='pic_photo_or_album'  || a=='pic_weixin'  || a=='location_select') {
      $("#key").show();
      $("#twoname").show();
      $("#event").show();
      $("#key1").show();
  }else{
      $("#key").hide();
  };
  if (a=='view') {
      $("#url").show();
      $("#twoname").hide();
      $("#event").hide();
      $("#key1").hide();
  }else{
      $("#url").hide();
  };
  if (a=='media_id' || a=='view_limited') {
      $("#media_id").show();
      $("#twoname").hide();
      $("#event").hide();
      $("#key1").hide();
  }else{
      $("#media_id").hide();
  };
 }
</script>


<!-- 二级菜单 -->
<script type="text/javascript">
//根据菜单类型，弹出适当的选项
var b=$('#select').val();//选中的值
//alert(b);
if (b=='click' || b=='scancode_push' || b=='scancode_waitmsg'  || b=='pic_sysphoto'  || b=='pic_photo_or_album'  || b=='pic_weixin'  || b=='location_select') {
      $("#key1").show();
      $("#url1").hide();
      $("#media_id1").hide();
  }else{
      $("#key1").hide();
  };
  if (b=='view') {
      $("#url1").show();
  }else{
      $("#url1").hide();
  };
function ttt(id) {
  var bb = document.getElementById(id).value;
  var b=bb;
 //alert(b);
  if (b=='click' || b=='scancode_push' || b=='scancode_waitmsg'  || b=='pic_sysphoto'  || b=='pic_photo_or_album'  || b=='pic_weixin'  || b=='location_select') {
      $("#key1").show();
  }else{
      $("#key1").hide();
  };
  if (b=='view') {
      $("#url1").show();
  }else{
      $("#url1").hide();
  };
  if (b=='media_id' || b=='view_limited') {
      $("#media_id1").show();
  }else{
      $("#media_id1").hide();
  };
 }
</script>
